






SSArray = class("SSArray",function()
    -- 继承
    local ret = {}
    ret.ary = {}
    ret.count = 0
    return ret
end)



function SSArray:create()
    return SSArray:new()
end


function SSArray:getCount()
    return self.count
end



function SSArray:add(obj)
    self.ary[self.count+1] = obj
    self.count = self.count + 1
    return self.count
end


function SSArray:getOneAt(i)
    return self.ary[i]
end



function SSArray:getIndexFor(obj)
    for i,o in pairs(self.ary) do 
        if o==obj then 
            return i
        end
    end
    return nil
end



function SSArray:remove(obj)
    local at = -1
    for i,o in pairs(self.ary) do 
        if o==obj then 
            at = i
            break;
        end
    end
    -- 
    if at<1 or at>self.count then 
        cclook("自定义数组删除时出错: at=%s, obj=%s", at, obj)
    end
    --
    for i=at, self.count-1 do 
        self.ary[i] = self.ary[i+1]
    end
    self.ary[self.count] = nil
    self.count = self.count - 1 
    return nil
end


function SSArray:removeIndex(at)
    -- 
    if at<1 or at>self.count then 
        cclook("自定义数组删除指定位置时出错: at=%s, obj=%s", at )
    end
    --
    for i=at, self.count-1 do 
        self.ary[i] = self.ary[i+1]
    end
    self.ary[self.count] = nil
    self.count = self.count - 1 
    return nil
end





